package org.ls.petclinic.web;

import org.ls.petclinic.dao.CustomerDao;
import org.ls.petclinic.dao.impl.CustomerDaoImpl;
import org.ls.petclinic.untils.JdbcUtils;
import org.ls.petclinic.untils.WebUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description
 * @Author 浪矢先生
 * @Create 2022-06-10 0:59
 */
@WebServlet(urlPatterns = "/deleteCustomer")
public class DeleteCustomerServlet extends BaseServlet {
    private CustomerDao customerDao=new CustomerDaoImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        customerDao.deleteCustormer(WebUtils.parseInt(req.getParameter("id"), 0));
        JdbcUtils.commitAndClose();
    }
}
